{{--/**
 * Created by PhpStrom
 * User: 郭碧云
 * Date: 2021/3/24 16:46
 * Desc:
 */--}}
<style>
    .layui-disabled, .layui-disabled:hover {
        color: #333 !important;
        cursor: not-allowed !important;
    }
</style>
<form id="link_menu" style="margin-top: 15px;" class="layui-form"
      action="{{route('admin.menu.link',['menu_id'=>$menu["data"]->id])}}"
      method="post">
    {{csrf_field()}}
    <div class="layui-form-item"><label class="layui-form-label">菜单名称</label>
        <div class="layui-input-block" style="line-height: 39px;">{{$menu["data"]->name}}</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">关联权限</label>
        <div class="layui-input-block">
            <select id="permission_id" name="permission_id" style="color:#999">
                @if($permissions['error']==0)
                    @foreach($permissions['data'] as $permission)
                        <option @if($menu["data"]->permission_id == $permission->id) selected @endif value="{{$permission->id}}">{{$permission->display_name}}</option>
                        @if(count($permission->children)>0)
                            @foreach($permission->children as $p)
                                <option @if($menu["data"]->permission_id == $p->id) selected @endif  value="{{$p->id}}">{{$p->display_name}}</option>
                                @if(count($p->children)>0)
                                    @foreach($p->children as $c)
                                        <option @if($menu["data"]->permission_id == $c->id) selected @endif  value="{{$c->id}}">{{$c->display_name}}</option>
                                    @endforeach
                                @endif
                            @endforeach
                        @endif
                    @endforeach
                @endif
            </select>
        </div>
    </div>
</form>

<script type="text/javascript">
    $(function () {
        $("#link_group").click(function () {
            let val = $("input[name='is_link']:checked").val();
            if (val == 1) {
                $("#uri_link").parent().parent().show();
                $("#uri").parent().parent().hide();
            }
            if (val == 0) {
                $("#uri_link").parent().parent().hide();
                $("#uri").parent().parent().show();
            }
        });
    })
</script>

